package com.wise.webservicecxf.client;

import com.alibaba.fastjson.JSONObject;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

public class UserClient {
    public static void main(String[] args) throws Exception {
        String wsdlAddress = "http://localhost:8080/service/user?wsdl";
        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
        Client client = dcf.createClient(wsdlAddress);
        //getUser 为接口中定义的方法名称 张三为传递的参数 返回一个Object数组
        Object[] objects = client.invoke("getUser", "411001");
        //输出调用结果
        System.out.println("*****"+ JSONObject.toJSONString(objects[0]));
    }
}
